function negLL = ptm5(params,wdata)
% 1: lottery weighting for buyer
% params(1): decisiveness
% params(2): response bias for buyer
% 1: lottery weighting for seller
% params(3): response bias for seller
% params(4): fixed utility for buyer
% params(5): fixed utility for seller

priceutil = wdata.Price;
lotteryutil = (wdata.Role==1).* (0.5.*1.*wdata.Lottery) + ...
              (wdata.Role==2).* (0.5.*1.*wdata.Lottery);
pending = (wdata.Role==1).*((params(2)>=0).*((1-params(2))./(1+exp(-params(1)*(lotteryutil-priceutil) + params(4)))+ params(2)) + (1-(params(2)>=0)).*(1+params(2))./(1+exp(-params(1)*(lotteryutil-priceutil) + params(4)))) + ...
          (wdata.Role==2).*((params(3)>=0).*((1-params(3))./(1+exp(-params(1)*(lotteryutil-priceutil) + params(5)))+ params(3)) + (1-(params(3)>=0)).*(1+params(3))./(1+exp(-params(1)*(lotteryutil-priceutil) + params(5)))) ;
% pending(pending==0) = eps; 
negLL = - sum( wdata.Ending.*log(pending) + (1-wdata.Ending).*log(1-pending) );

end